package com.baizhi.service.impl;

import com.baizhi.dao.UserDao;
import com.baizhi.entity.User;
import com.baizhi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    @Transactional(readOnly = true)
    public boolean login(String name, String password) {
        User user = userDao.selectByName(name);
        if(user!=null && user.getPassword().equals(password)){
            return true;
        }
        return false;
    }

    @Override
    @Transactional(readOnly = true)
    public User selectByName(String name) {
        return userDao.selectByName(name);
    }
}
